package com.niit.gams.business.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.niit.gams.business.dao.SingerMapper;
import com.niit.gams.business.pojo.Singer;
import com.niit.gams.business.service.SingerService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SingerServiceImpl implements SingerService {
  private SingerMapper singerMapper;

  public SingerServiceImpl(SingerMapper singerMapper) {
    this.singerMapper = singerMapper;
  }

  @Override
  public PageInfo<Singer> findSingers(int curPage, int pageSize) {
    PageHelper.startPage(curPage, pageSize);
    List<Singer> singerList = singerMapper.selectAll();
    PageInfo<Singer> pageInfo = new PageInfo<>(singerList);
    return pageInfo;
  }
}
